package com.xy.file.strategy;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Configuration
public class FileStrategyFactory {

    @Resource
    private List<FileStrategy> fileStrategyList;

    @Bean("fileStrategyMap") // 指定 Bean 名称

    public Map<String, FileStrategy<?>> excelStrategyStrategies() {
        Map<String, FileStrategy<?>> strategyMap = new HashMap<>();

        for (FileStrategy excelStrategy : fileStrategyList) {

            strategyMap.put(excelStrategy.getStrategyClassStr(), excelStrategy);

        }
        return strategyMap;
    }


}
